﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace instantget
{
    public partial class FoForm : Form
    {
        int pass;
        string user;
        public FoForm()
        {
            InitializeComponent();
        }

        private void FoForm_Load(object sender, EventArgs e)
        {
            Bejelentkezes bej = new Bejelentkezes();
            bej.ControlBox = false;
            bej.ShowDialog();
            pass = Properties.Settings.Default.aktualisJelszo;
            user = Properties.Settings.Default.aktualisUser;
            this.felhasznaloTableAdapter.FillByUser(this.instantgetDataSet.felhasznalo, pass, user);
            var seged = (from x in felhasznaloTableAdapter.GetDataByUser(pass, user) select x).First();
            label3.Text = seged.vnev + " " + seged.knev;
            
        }

        private void kilépésToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Biztosan kilép?","Kilépés",MessageBoxButtons.YesNo, MessageBoxIcon.Question)==DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void tárgyakListázásaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FoFormPanel.Controls.Clear();
            TListaUC tluc = new TListaUC();
            FoFormPanel.Controls.Add(tluc);
            tluc.Anchor = AnchorStyles.Top;
            tluc.Anchor = AnchorStyles.Bottom;
            tluc.Anchor = AnchorStyles.Left;
        }

        private void beállításokToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Beallitasok beall = new Beallitasok();
            if (beall.ShowDialog() == DialogResult.OK)
            {
                this.BackColor = Properties.Settings.Default.Hatterszin;
                this.ForeColor = Properties.Settings.Default.Szovegszin;
                if (Properties.Settings.Default.Fajlnev != "")
                {
                    Bitmap bp = new Bitmap(Properties.Settings.Default.Fajlnev);
                    BackgroundImage = bp;
                    BackgroundImageLayout = ImageLayout.Stretch;
                }
            }
        }

        private void sajátTárgyFelvételeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Targyfelvetel tf = new Targyfelvetel(user, pass);
            tf.BackColor = Properties.Settings.Default.Hatterszin;
            tf.ForeColor = Properties.Settings.Default.Szovegszin;
            if (Properties.Settings.Default.Fajlnev != "")
            {
                Bitmap bp = new Bitmap(Properties.Settings.Default.Fajlnev);
                tf.BackgroundImage = bp;
            }
            tf.ShowDialog();
        }

        private void vevőjelentésToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FoFormPanel.Controls.Clear();
            VevoJelentesUC vjuc = new VevoJelentesUC();
            this.FoFormPanel.Controls.Add(vjuc);
            vjuc.Anchor = AnchorStyles.Bottom;
            vjuc.Anchor = AnchorStyles.Left;
        }

        private void aukcióimToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FoFormPanel.Controls.Clear();
            SajatAukciokUC sAUC = new SajatAukciokUC();
            this.FoFormPanel.Controls.Add(sAUC);
            sAUC.Anchor = AnchorStyles.Bottom;
            sAUC.Anchor = AnchorStyles.Left;
        }
    }
}
